#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <math.h>
int main() {
    char PassWord[110] = { 0 };
    int n, flag = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        flag = 0;
        scanf("%s", PassWord);
        if (strlen(PassWord) >= 8)
        {
            if (PassWord[0] >= '0' && PassWord[0] <= '9')
            {
                printf("NO\n");
            }
            else {
                for (int i = 1; i < strlen(PassWord); i++)
                {
                    if (!(PassWord[i] >= '0' && PassWord[i] <= '9' || PassWord[i] >= 'a' && PassWord[i] <= 'z' || PassWord[i] >= 'A' && PassWord[i] <= 'Z'))
                    {
                        flag = 1;
                        break;
                    }
                }
                if (flag == 1)
                    printf("NO\n");
                else
                    printf("YES\n");
            }
        }
        else {
            printf("NO\n");
        }
    }
    return 0;
}